﻿using System.Collections.Generic;
using Koonsoft.HYCRM.DAL;
using Koonsoft.HYCRM.Model;

namespace Koonsoft.HYCRM.BLL
{
    public class RoleBLL
    {
        private RoleDAL _dal = null;

        protected RoleDAL DAL
        {
            get
            {
                if (_dal == null)
                {
                    _dal = new RoleDAL();
                }

                return _dal;
            }
        }

        /// <summary>
        /// 根据登录名获取角色ID
        /// </summary>
        /// <param name="loginName"></param>
        /// <returns></returns>
        public int GetRoleIDByLoginName(string loginName)
        {
            return DAL.GetRoleIDByLoginName(loginName);
        }

        /// <summary>
        /// 获取所有角色
        /// </summary>
        /// <returns></returns>
        public List<RoleInfo> GetRoles()
        {
            return DAL.GetRoles();
        }
    }
}
